﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Threading;
using System.Globalization;
using TripLOA.GUI.internationalization;

namespace TripLOA.GUI.internationalization
{
    public partial class LOABasePage : System.Web.UI.Page
    {
        protected override void InitializeCulture()
        {
            //retrieve culture information from session
            string culture = Convert.ToString(Session[LOAGlobal.Global.SESSION_KEY_CULTURE]);

            //check whether a culture is stored in the session
            if (culture.Length > 0) Culture = culture;

            //set culture to current thread
            try
            {
                
               Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(culture);
               Thread.CurrentThread.CurrentUICulture = new CultureInfo(culture);
            }
            catch (ArgumentException)
            {
                culture = LOACulture.Culture.EN;
                Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(culture);
                Thread.CurrentThread.CurrentUICulture = new CultureInfo(culture);
            }
            //call base class
            base.InitializeCulture();
        }
    }
}